<%--
  Created by IntelliJ IDEA.
  User: ljh
  Date: 2024/9/22
  Time: 12:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.sql.*" %>
<%@ page import="day240923.MyDBUtil" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<table>
    <thead>
    <tr>
        <th>Name</th>
        <th>Age</th>
    </tr>
    </thead>
    <tbody>
<%

  try{ Statement statement =MyDBUtil.getConnection().createStatement();
      ResultSet rs = statement.executeQuery("select name,age from users");
      while(rs.next()){
          String name = rs.getString("name");
          String age = rs.getString("age");
%>
    <tr>
    <td><%= name %></td>
    <td><%= age %></td>
    </tr>
<%

      }
  }catch (SQLException ex) {
      ex.printStackTrace();
      }
%>

</table>


</body>
</html>